package com.itheima.day15.work5;

import java.io.*;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.Scanner;

/*
* TCp的886  多线程操作
* */
public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket  ss=new Socket("127.0.0.1",10007);
        BufferedWriter  bw=new BufferedWriter(new OutputStreamWriter(ss.getOutputStream()));
      //  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        Scanner  sc=new Scanner(System.in);
        String  s;
        System.out.print("客户端输入：");
        while ((s=sc.nextLine())!=null){

            if (s.equals("886")){
                break;
            }
            bw.write(s);
            bw.newLine();
            bw.flush();
        }
        ss.shutdownOutput();
        BufferedReader  br1=new BufferedReader(new InputStreamReader(ss.getInputStream()) );
        String len;
        while ((len=br1.readLine())!=null){
            System.out.println("服务器端反馈信息："+len);
        }
        bw.close();
        br1.close();
        ss.close();
    }
}
